Form Will Not Update MySQL DB
am 12.08.2007 02:09:28 von chrisvHello everyone.
I have a simple form that is designed to update a single database
record at a time. It works fine until my pageaction variable is set
to "update". The update conditional code doesn't execute. It is
supposed to trigger an mysql record update using a predefined query.
The username used to query the database has all privileges, so that
isn't the problem. An suggestions? Here is the code:
------------------------------------------------------------ ------------------------------------------------------------ --------------------------
//get your hbc database connection
include "db_connect.php";
/
************************************************************ *********************************/
$cid =
$_REQUEST['consumer_id'];
$fullname =
$_REQUEST['consumer_fullname'];
/
************************************************************ *********************************/
$date = $_REQUEST['consumer_date'];
$nursingfacility =
$_REQUEST['consumer_nursing_facility'];
$nursingfacilityaddress =
$_REQUEST['consumer_nursing_facility_address'];
$coordinator = $_REQUEST['consumer_coordinator'];
$casenote = $_REQUEST['consumer_note'];
$isn = $_REQUEST['consumer_isn'];
$status = $_REQUEST['consumer_status'];
$pageaction = $_REQUEST['pageaction'];
$change = $_REQUEST['change'];
/
************************************************************ ***********************************/
//handles all EDIT->UPDATE FUNCTIONS
//with $pageaction var
if($pageaction=="update"){
if($fullname!=""){
$file_update = "UPDATE `hbc_consumers`
SET
`hbc_consumers`.`consumer_fullname`='$fullname'
WHERE `hbc_consumers`.`consumer_id`='$cid'";
$result_of_updated_file = mysql_query($file_update)
or die(mysql_error());
}//use elseif to add more options
}//end UPDATE FUNCTIONS
/
*----------------------------------------------------------- --------*/
/**************************** QUERY ONE
******************************/
/
*----------------------------------------------------------- --------*/
/* GETS the CONSUMER RECORD */
$Select_consumer= "SELECT *
FROM `hbc_consumers`
WHERE `consumer_id`='$cid'";
/* HOLDS CONSUMER RECORD data */
$Query_consumer = mysql_query($Select_consumer) or
die(mysql_error());
$fetch_consumer_info = mysql_fetch_array($Query_consumer);
$cid =
$fetch_consumer_info['consumer_id'];
$fullname =
$fetch_consumer_info['consumer_fullname'];
$date =
$fetch_consumer_info['consumer_date'];
$nursingfacility =
$fetch_consumer_info['consumer_nursing_facility'];
$nursingfacilityaddress =
$fetch_consumer_info['consumer_nursing_facility_address'];
$coordinator =
$fetch_consumer_info['consumer_coordinator'];
$casenote =
$fetch_consumer_info['consumer_note'];
$isn =
$fetch_consumer_info['consumer_isn'];
$status =
$fetch_consumer_info['consumer_status'];
?>
"http://www.w3.org/TR/html4/loose.dtd">
Page